package com.example.takeout_project.common;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DataBaseConnection {
    private static String url = "jdbc:mysql://localhost:3306/reggie";
    private static String user = "root";
    private static String password = "jia031229";
    public static void main(String[] args) {
        try{
            Class.forName("com.mysql.cj.jdbc.Driver");

            Connection conn = DriverManager.getConnection(url,user,password);

            if (conn != null){
                System.out.println("数据库连接成功");
            }else {
                System.out.println("数据库连接失败");
            }

        }catch (ClassNotFoundException e){

        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}
